// 导入用户集合
const { Article } = require('../../../model/article');

module.exports = async (req, res) => {
  const { author, category, title, cover, description, content } = req.body
  Article.create({ author, category, title, cover, description, content }).then(item => {
    res.json({
        data: item,
        message: '添加成功！'
    })
  }).catch((err) => {
    res.status(403)
    res.json({
        log: err,
        message: '添加失败！'
    })
  })
}